<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>商品属性</title>
     <script type="text/javascript" src="<c:url value='/static/js/admin/product/attribute.js' />"></script>
</head>

<body>
<c:if test="${!empty msg}">
	<div class="alert alert-green fadein-top"><span class="close rotate-hover"></span><strong>提示：</strong>${msg}</div>
</c:if>
<div class="panel admin-panel">
	<div class="panel-head"><strong>商品属性</strong></div>
	<div class="padding">
		<form id="form" method="post" action="<c:url value='/admin/product/save' />" class="form">
			<input id="id" type="hidden" name="id" value="${product.id}"/>
			<div class="line">
				<%-- <div class="x3">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="productName">商品编号</label>
							</div>
							<div class="field">
								<input type="text" class="input" id="productCode" name="productCode" value="${product.productCode}" 
									placeholder="请填写商品编号" data-validate="required:必填" <c:if test="${!empty product.productCode}">readonly="readonly"</c:if>  />
							</div>
						</div>
					</div>
				</div> --%>
				<div class="x7">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="productName">商品名称</label>
							</div>
							<div class="field">
								<input type="text" class="input" id="productName" name="productName" value="${product.productName}" 
									placeholder="请填写商品名称" data-validate="required:必填,length#<=250:不超过250个字" />
							</div>
						</div>
					</div>
				</div>
				<div class="x1"></div>
				<div class="x3">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="stock">商品库存</label>
							</div>
							<div class="field">
								<input type="text" class="input" id="stock" name="stock" value="${product.stock}" 
									placeholder="请填写商品库存" data-validate="required:必填,plusinteger:只能为正整数" />
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="line">
				<div class="x3">
					<div class="form-group">
						<div class="label">
							<label for="marketPrice">零售价</label>
						</div>
						<div class="field">
							<input type="text" class="input" id="marketPrice" name="marketPrice" value="${product.marketPrice}" 
								placeholder="请填写零售价" data-validate="required:必填,plusdouble:请填写正确的金额" />
						</div>
					</div>
				</div>
				<div class="x1"></div>
				<div class="x3">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="salesPrice">预售价</label>
							</div>
							<div class="field">
								<input type="text" class="input" id="salesPrice" name="salesPrice" value="${product.salesPrice}" 
									placeholder="请填写预售价" data-validate="required:必填,plusdouble:请填写正确的金额" />
							</div>
						</div>
					</div>
				</div>
				<div class="x1"></div>
				<div class="x3">
					<div class="form-group">
						<div class="label">
							<label for="marketPrice">状态</label>
						</div>
						<div class="field">
							<div class="button-group radio"> 
								<label id="state1" class="button <c:if test="${product.state == 1}">active</c:if>">
									<input name="state" value="1" <c:if test="${product.state == 1}">checked="checked"</c:if> type="radio">
									<span class="icon icon-check text-green"></span> 上架
								</label>
								<label id="state2" class="button <c:if test="${product.state == 0}">active</c:if>">
							 		<input name="state" value="0" <c:if test="${product.state == 0}">checked="checked"</c:if> type="radio">
							 		<span class="icon icon-times"></span> 下架
							 	</label>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="line">
				<div class="x4">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="image1">商品图片</label>
							</div>
							<div class="field" style="height:100px;">
								<span>
								注意：商品图片最多上传5张，
								每张大小不超过2M，第一张为默认展示图片，建议尺寸360*360像素</span>
								<br/>
								<a id="upload-images-btn" href="javascript:;" class="button bg pick-btn" style="border: 0;padding: 0;">选择图片</a>
							</div>
						</div>
					</div>
				</div>
				<div class="x1"></div>
				<div class="x7">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label>&nbsp;</label>
							</div>
							<div class="field">
								<ul class="filelist"></ul>
								<input type="hidden" id="image1" value="${product.image1}"/>
								<input type="hidden" id="image2" value="${product.image2}"/>
								<input type="hidden" id="image3" value="${product.image3}"/>
								<input type="hidden" id="image4" value="${product.image4}"/>
								<input type="hidden" id="image5" value="${product.image5}"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="line">
				<div class="x12">
					<div class="form-group">
						<div class="form-group">
							<div class="label">
								<label for="productBrief">商品简介</label>
							</div>
							<div class="field">
								<textarea class="input" id="productBrief" name="productBrief" placeholder="请填写商品简介">${product.productBrief}</textarea>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="line">
				<div class="x12">
					<div class="form-group">
						<div class="label">
							<label>商品详情</label>
						</div>
						<div class="field">
							<script id="detail" name="detail" type="text/plain" style="width:auto;height:320px;">${product.detail}</script>
						</div>
					</div>
				</div>
			</div>
			<br/>
			<div class="form-button">
				<button id="save-btn" class="button bg-main" type="button">保存</button>
				<button onclick="locationHref('<c:url value='/admin/product/list' />')" class="button bg-gray" type="button">返回</button>
			</div>
		</form>
	</div>
</div>
</body>
</html>